package br.com.vagacerta.controller;

import java.util.List;

import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.stereotype.Controller;
import org.springframework.ui.Model;
import org.springframework.web.bind.annotation.RequestMapping;

import br.com.vagacerta.dao.VagaDAO;
import br.com.vagacerta.modelo.Vaga;

@Controller
public class MapaDeVagasController {
	
	private final VagaDAO vagaDAO;
		
	
	
	@Autowired
	public MapaDeVagasController(VagaDAO vagaDAO) {
		this.vagaDAO = vagaDAO;
	}

	
	@RequestMapping("carregaMapa")
	public String carregaPaginaMapaDeVagas(Model model) {
		List<Vaga> listaVagas = vagaDAO.carregaTodasAsVagas();

		model.addAttribute("listaVagas", listaVagas);
		
		return "mapa/tabelaMapa";
	}
	
	
}
